package com.jishuo.nontax.bfc.dao;

import com.jishuo.nontax.bean.vo.MessageVO;
import com.jishuo.nontax.bean.vo.QueryMessageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author :hanlipeng
 * @description :
 * @create :2022-12-05 17:22:00
 */
@Mapper
public interface MessageSysMapper {

    /**
     * 查询表转台是否
     */
    int findMessageSendCoung(String sn);

    /**
     * 创建发送消息
     */
     int saveMessageSend(@Param("messageid") long messageid,@Param("message") String message,@Param("hbfs") String hbfs,
                        @Param("queue") String queue, @Param("filepath") String filepath,@Param("version") String version,
                        @Param("sender") String sender,@Param("receiver") String receiver,@Param("action") String action,
                        @Param("billcount") String billcount,@Param("sn") String sn, @Param("valueid") int valueid,
                        @Param("date") String date, @Param("signmessage") String signmessage);

    /**
     * 收到查询数据后，更新消息发送状态
     * @param sn
     * @param state 状态
     * @return
     */
    int updateMessageSendFinish(@Param("sn") String sn, @Param("state") int state, @Param("finishtime") String finishtime);

    /**
     * 创建接收消息
     */
    int saveMessageReceive(@Param("messageid") long messageid, @Param("hbfs") String hbfs, @Param("receivequeue") String receivequeue,
                           @Param("msgid") String msgid, @Param("filepath") String filepath, @Param("createtime") String createtime,
                           @Param("state") int state);

    /**
     * 更新接收消息状态
     * @param messageid 消息ID
     * @param state 状态
     * @return
     */
    int updateMessageReceiveFinish(@Param("messageid") long messageid, @Param("state") int state, @Param("finishtime") String finishtime);

    /**
     * 消息解密、验签后，跟新接收消息
     */
    int updateMessageReceive(@Param("messageid") long messageid,@Param("message") String message,@Param("version") String version,
                             @Param("sender") String sender,@Param("receiver") String receiver,@Param("action") String action,
                             @Param("infocount") String infocount,@Param("sn") String sn, @Param("info") String info,
                             @Param("state") int state, @Param("finishtime") String finishtime);


    List<String> isEnableSend(String ft);

    List<QueryMessageVO> queryMessageLog(@Param("action") String action, @Param("senddate") String senddate);

    List<QueryMessageVO> queryMessageSendLog(@Param("action") String action,@Param("senddate") String senddate);

    int updateMessageState(Long messageid);

    int updateMessageSendState(Long messageid);

    int deleteDateMessage(String dt);

    List<MessageVO> getEleMessageList();

    List<MessageVO> getEleMessageSendList();

    int deleteDateMessageSend(String dt);

    int updateMessageSendStateOne(@Param("paybankdt")String paybankdt,@Param("messageid")String messageid);

    /**
     * 增加消息缓存
     * @param sn key
     * @param addTime 时间戳
     * @return
     */
    int insertMessageCache(@Param("sn")String sn, @Param("addTime")long addTime);

    Long selectMessageCache(String sn);

    /**
     * 删除过期的消息缓存
     * @param minTime 最小时间戳
     * @return
     */
    int clearMessageCache(long minTime);
}



